import edu.vanderbilt.isis.sm.Event;
import edu.vanderbilt.isis.sm.StateflowInterpreter;
import edu.vanderbilt.isis.sm.SymbolicDataProvider;

public class TestTimer {

	// Timer
	TopLevelTimerVPC t;
	
	public TestTimer() {
		this.t = new TopLevelTimerVPC();
		
		TimerVPCReader tReader = new TimerVPCReader(this.t.r1.TimerVPC3, new SymbolicDataProvider(1),null);

		this.t.sim = new StateflowInterpreter(this.t.sm, tReader);
		this.t.sim.disablePrinting();
		this.t.sim.initialize();
	}
	
	public static void main(String[] args) {
		System.out.println("********************");
		TestTimer test = new TestTimer();
		printTimerVPC(test.t);
		Event e = new Event("");
		for (int i = 0; i<20; i++) {
			test.t.sim.addEvent(e);
			test.t.sim.step();
			printTimerVPC(test.t);
		}		
	}

	private static void printTimerVPC(TopLevelTimerVPC t) {
		StringBuilder builder = new StringBuilder();
		builder.append("TimerVPC={reset=" + t.r1.TimerVPC3.reset);
		builder.append("; var1=" + t.r1.TimerVPC3.var1);
		builder.append("; var2=" + t.r1.TimerVPC3.var2);
		builder.append("; var3=" + t.r1.TimerVPC3.var3);
		builder.append("; var4=" + t.r1.TimerVPC3.var4);
		builder.append("; var5=" + t.r1.TimerVPC3.var5);
		builder.append("; var6=" + t.r1.TimerVPC3.var6);
		builder.append("}");
		System.out.println(builder.toString());
	}
	
}
